Learning Objectives

After completing this lesson, you’ll be able to:

What is a Database Connection?

When the source data for a dataset is a database, you can optionally store connection parameters in a secure container called a database connection. That container can be either published to FME Server or recreated on it.

Database connections are containers for a set of database connection parameters. These parameters include the database server, port number, username, password, and other parameters that vary according to the database type. Some database types support optional authentication parameters. For example, when creating a Database Connection on FME Server for PostgreSQL, there are optional authentication parameters which include: CA Certificate, Client Certificate, Client Private Key and SSL Password. 

The two main advantages of database connections are:

Database connections can be published with a workspace from FME Desktop, or they can be added directly within FME Server.

Creating Database Connections

Creating a database connection usually starts in FME Desktop. The connections can be created using Tools > FME Options > Database Connections in the FME Workbench menubar. The defined connection can then be used in a reader, writer, or transformer. Alternatively, when the author adds a Transformer, Reader or Writer to FME Workbench that requires a Database Connection but there is no existing connection for this format, they are prompted with the option to add a Database Connection from within this wizard.

As an example, this workspace has a connection for a PostGIS database, as seen in Navigator under the reader parameters and in the list of database connections:

Navigator showing the use of a Database Connection

When the workspace is published to FME Server a new dialog asks the author whether they would also like to publish the database connection:

Publishing a database connection to FME Server

The connection is then added to the connections container on FME Server.

Note

Note that you don't have to upload the connection with the workspace. If a connection for that database already exists on FME Server you can use that. FME Workbench should recognize whether a connection with the same name is already available, if it is, by default the box will not be checked.

If you don't upload the connection, and you don't already have one to use on FME Server, then you will need to use the Database Connections page to create one.

Managing Database Connections

FME Server has a page for managing database connections accessed through the main menu:

Database Connections menu option

This page allows workspace authors - but usually administrators - to create new connections and copy, delete or edit existing connections:

Editing database connection

Using Database Connections

When a workspace is run, if it has a database reader (for example) the end-user is prompted with a published parameter and can select the database connection to use:

Setting a Connection parameter

The workspace then runs to completion as normal.

Note

Connections, like other objects on FME Server, have security permissions. Only the owner, someone with whom the connection is shared, or (by default) an administrator, can make use of it. It's not the case that any random user will be provided access to all database connections via the published parameter.

This fact becomes particularly important when creating FME Server workflows that require access to the Connection, for example, Server Apps (see Create No-Code Web Apps). Make sure you grant explicit permissions to web and database connections when creating these workflows.

This also means that a workspace can be tested in FME Desktop using the author's connection parameters, but then require the end user's connection once published to Server; all in a way that is both easy and secure.

What is a Web Connection?

Just as for databases, when the source data for a dataset is a web service, FME is capable of storing connection parameters in a secure container called a web connection. That container can be either published to FME Server or recreated on it.

Web connections are containers for a set of web service connection parameters. These parameters include the service, username, password (or authenticated connection), and others that vary according to the service type.

The two main advantages of web connections are:

Web connections can be published with a workspace from FME Desktop, or they can be added directly within FME Server.

Creating Web Connections

Creating a web connection often starts in FME Desktop. They can be created using Tools > FME Options > Web Connections in the FME Workbench menubar. The defined connection can then be used in a reader, writer, or transformer.

For example, this workspace reads a CSV dataset using a connection to a Google Drive web service, as seen in the Navigator under both the reader parameters and the list of web connections:

Navigator with a writer using a web connection

When the workspace is published to FME Server a new dialog asks the author whether they would also like to publish the web connection:

Publishing a web connection to FME Server

The connection is then added to the connections container on FME Server.

Note

WARNING: While uploading a web service from Desktop is enough to run the connection, this service definition is provided by Safe Software for demonstration purposes and ease of use. The client id and client secret may become deactivated at any time. For production use, we recommend users obtain their own client id and client secret from the web service provider. Setting up the service definition for OAuth authentication is a task best left to system administrators.

Using Web Connections

When a workspace is run, if it has a transformer or reader that references a web service then it will run correctly, just as on an FME Desktop installation.

In the published parameters on FME Server, the web connection can be defined in the source dataset URL:

Using a web connection with a URL

Or, it can appear in a dropdown menu item if used as a published parameter in a workspace:

Selecting a Web Connection parameter

Note

As with database connections, this functionality allows a workspace to be tested in FME Desktop using the author's connection parameters, but then switched to a general account once published to Server; all in a way that is both easy and secure.